home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_069 / sb / sbwindow.c < prev   
C/C++ Source or Header  |  1992-05-06  |  8KB  |  196 lines

  1. /* include not needed for Aztec C using provided makefile */
  2. #include "sb:sb.h"
  3. extern int level;
  4. extern void PrWindow2(), PrWindow3();
  5.  
  6.  
  7. void PrWindow(string, window) char *string; struct Window *window;
  8. {
  9. static struct StructData structdata[] = {
  10.      { " NextWindow",   "struct Window *",     5, PTRSIZE },
  11.      { "-LeftEdge",     "SHORT",               2, INTSIZE },
  12.      { "-TopEdge",      "SHORT",               2, INTSIZE },
  13.      { "-Width",        "SHORT",               2, INTSIZE },
  14.      { "-Height",       "SHORT",               2, INTSIZE },
  15.      { "-MouseY",       "SHORT",               2, INTSIZE },
  16.      { "-MouseX",       "SHORT",               2, INTSIZE },
  17.      { "-MinWidth",     "SHORT",               2, INTSIZE },
  18.      { "-MinHeight",    "SHORT",               2, INTSIZE },
  19.      { "-MaxWidth",     "SHORT",               2, INTSIZE },
  20.      { "-MaxHeight",    "SHORT",               2, INTSIZE },
  21.      { " Flags",        "ULONG",              11, PTRSIZE },
  22.      { "(MenuStrip",    "struct Menu *)",      5, PTRSIZE },
  23.      { " Title",        "UBYTE *",             4, PTRSIZE },
  24.      { "(FirstRequest", "struct Requester *)", 5, PTRSIZE },
  25.      { "(DMRequest",    "struct Requester *)", 5, PTRSIZE }
  26.   };
  27. static char *flagnames[32] = {
  28.      "WINDOWSIZING",    "WINDOWDRAG",   "WINDOWDEPTH",    "WINDOWCLOSE",
  29.      "SIZEBRIGHT",      "SIZEBOTTOM",   "SIMPLE_REFRESH", "OTHER_REFRESH",
  30.      "BACKDROP",        "REPORTMOUSE",  "GIMMEZEROZERO",  "BORDERLESS",
  31.      "ACTIVATE",        "WINDOWACTIVE", "INREQUEST",      "MENUSTATE",
  32.      "RMBTRAP",         "NOCAREREFRESH", NULL,            NULL,
  33.      NULL,              NULL,            NULL,            NULL,
  34.      "WINDOWREFRESH",   "WBENCHWINDOW",  "WINDOWTICKED"
  35.   };
  36. int sum, choice = -1;
  37. ULONG bits;
  38.   level++;
  39.   while (choice) {
  40.     sum = SetOptionText(string, structdata, (APTR)window, DATASIZE, 0);
  41.     switch (choice = GetChoice(MAXGADG + 1)) {
  42.       case 1:
  43.         if (window->NextWindow)
  44.           PrWindow("The next window in Intuition's list", window->NextWindow);
  45.         break;
  46.       case 12:
  47.         bits = window->Flags & ~SUPER_UNUSED;
  48.         switch ((bits & REFRESHBITS) >> 6) {
  49.           case 0:
  50.             flagnames[6] = "SMART_REFRESH";
  51.             bits |= 0x40;
  52.             break;
  53.           case 1:
  54.             flagnames[6] = "SIMPLE_REFRESH";
  55.             break;
  56.           case 2:
  57.             flagnames[7] = "SUPER_BITMAP";
  58.             break;
  59.           case 3:
  60.             flagnames[7] = "OTHER_REFRESH";
  61.             bits ^= 0x40;
  62.             break;
  63.         }
  64.         FlagPrint("Flags set in this window", flagnames, bits);
  65.         break;
  66.       case 14:
  67.         PrString("The Window's Title", window->Title);
  68.         break;
  69.       case MOREGADG:
  70.         PrWindow2("Window menbers (page 2)", window, sum);
  71.         break;
  72.     }
  73.   }
  74.   level--;
  75. }
  76.  
  77.  
  78. void PrWindow2(string, window, offset)
  79. char *string; struct Window *window; int offset;
  80. {
  81. static struct StructData structdata[] = {
  82.      { "-ReqCount",     "SHORT",               2, INTSIZE  },
  83.      { " WScreen",      "struct Screen *",     5, PTRSIZE  },
  84.      { " RPort",        "struct RastPort *",   5, PTRSIZE  },
  85.      { "-BorderLeft",   "BYTE",                3, BYTESIZE },
  86.      { "-BorderTop",    "BYTE",                3, BYTESIZE },
  87.      { "-BorderRight",  "BYTE",                3, BYTESIZE },
  88.      { "-BorderBottom", "BYTE",                3, BYTESIZE },
  89.      { " BorderRPort",  "struct RastPort *",   5, PTRSIZE  },
  90.      { " FirstGadget",  "struct Gadget *",     5, PTRSIZE  },
  91.      { " Parent",       "struct Window *",     5, PTRSIZE  },
  92.      { " Descendant",   "struct Window *",     5, PTRSIZE  },
  93.      { "(Pointer",      "USHORT *",            5, PTRSIZE  },
  94.      { "-PtrHeight",    "BYTE",                3, BYTESIZE },
  95.      { "-PtrWidth",     "BYTE",                3, BYTESIZE },
  96.      { "-XOffset",      "BYTE",                3, BYTESIZE },
  97.      { "-YOffset",      "BYTE",                3, BYTESIZE }
  98.   };
  99. int sum, choice = -1;
  100.   level++;
  101.   while (choice) {
  102.     sum = SetOptionText(string, structdata, (APTR)window, DATASIZE, offset);
  103.     switch (choice = GetChoice(MAXGADG + 1)) {
  104.       case 2:
  105.         if (window->WScreen)
  106.           PrScreen("The screen referenced in the window structure",
  107.              window->WScreen);
  108.         break;
  109.       case 3:
  110.         if (window->RPort)
  111.           PrRastPort("The window's RPort (RastPort)", window->RPort);
  112.         break;
  113.       case 8:
  114.         if (window->BorderRPort)
  115.           PrRastPort("The window's BorderRPort", window->BorderRPort);
  116.         break;
  117.       case 9:
  118.         if (window->FirstGadget)
  119.           PrGadget("The window's first gadget", window->FirstGadget);
  120.         break;
  121.       case 12:
  122.         printf("Sorry, selection not implemented\n\n");
  123.         break;
  124.       case 10:
  125.         if (window->Parent)
  126.           PrWindow("The 'parent' window", window->Parent);
  127.         break;
  128.       case 11:
  129.         if (window->Descendant)
  130.           PrWindow("The 'descendent' window", window->Descendant);
  131.         break;
  132.       case MOREGADG:
  133.         PrWindow3("Window members (page 3)", window, sum);
  134.         break;
  135.     }
  136.   }
  137.   level--;
  138. }
  139.  
  140.  
  141. void PrWindow3(string, window, offset)
  142. char *string; struct Window *window; int offset;
  143. {
  144. static struct StructData structdata[] = {
  145.      { " IDCMPFlags",   "ULONG",                  1, PTRSIZE  },
  146.      { " UserPort",     "struct MsgPort *",       5, PTRSIZE  },
  147.      { " WindowPort",   "struct MsgPort *",       5, PTRSIZE  },
  148.      { "(MessageKey",   "struct IntuiMessage *)", 5, PTRSIZE  },
  149.      { "-DetailPen",    "UBYTE",                 13, BYTESIZE },
  150.      { "-BlockPen",     "UBYTE",                 13, BYTESIZE },
  151.      { "(CheckMark",    "struct Image *)",        5, PTRSIZE  },
  152.      { " ScreenTitle",  "UBYTE",                  4, PTRSIZE  },
  153.      { "-GZZMouseX",    "SHORT",                  2, INTSIZE  },
  154.      { "-GZZMouseY",    "SHORT",                  2, INTSIZE  },
  155.      { "-GZZWidth",     "SHORT",                  2, INTSIZE  },
  156.      { "-GZZHeight",    "SHORT",                  2, INTSIZE  },
  157.      { "(ExtData",      "UBYTE *)",               5, PTRSIZE  },
  158.      { "(UserData",     "BYTE *)",                5, PTRSIZE  },
  159.      { "(WLayer",       "struct Layer *)",        5, PTRSIZE  }
  160.   };
  161. static char *IDCMPnames[32] = {
  162.      "SIZEVERIFY",     "NEWSIZE",       "REFRESHWINDOW",  "MOUSEBUTTONS",
  163.      "MOUSEMOVE",      "GADGETDOWN",    "GADGETUP",       "REQSET",
  164.      "MENUPICK",       "CLOSEWINDOW",   "RAWKEY",         "REQVERIFY",
  165.      "REQCLEAR",       "MENUVERIFY",    "NEWPREFS",       "DISKINSERTED",
  166.      "DISKREMOVED",    "WBENCHMESSAGE", "ACTIVATEWINDOW", "INACTIVEWINDOW",
  167.      "DELTAMOVE",      "VANILLAKEY",    "INTUITICKS",     NULL,
  168.      NULL,             NULL,            NULL,             NULL,
  169.      NULL,             NULL,            NULL,             "LONELYMESSAGE"
  170.   };
  171. int sum, choice = -1;
  172.   level++;
  173.   while (choice) {
  174.     sum = SetOptionText(string, structdata, (APTR)window, DATASIZE, offset);
  175.     switch (choice = GetChoice(DATASIZE)) {
  176.       case 1:
  177.         FlagPrint("IDCMP flags set in this window",
  178.               IDCMPnames, window->IDCMPFlags);
  179.         break;
  180.       case 2:
  181.         if (window->UserPort)
  182.           PrMsgPort("Window->UserPort",window->UserPort);
  183.         break;
  184.       case 3:
  185.         if (window->WindowPort)
  186.           PrMsgPort("Window->WindowPort",window->WindowPort);
  187.         break;
  188.       case 8:
  189.         PrString("The screen title when this window is activated",
  190.                  window->ScreenTitle);
  191.         break;
  192.     }
  193.   }
  194.   level--;
  195. }
  196.